var app = getApp();
var com = require('../../common.js');
Page({
  data: {
    info: {}
  },
  onLoad: function(options) {
    console.log(options)
    if (options.type) {
      wx.setStorageSync('upData', options.type)
    } else {
      wx.removeStorageSync('upData')
    }
    var _this = this
    wx.getSystemInfo({
      success(res) {
        console.log(res)
        if (res.platform == 'ios') {
          _this.setData({
            padd: true
          })
        }
      }
    })
    _this.onShopStatus()
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  //修改地址
  onInputValue(e) {
    var _this = this,
      id = e.currentTarget.id,
      info = _this.data.info
    if (id == 1) {
      info.title = e.detail.value
    } else {
      info.address = e.detail.value
    }
    _this.setData({
      info: info
    })
  },
  //获取信息
  onShopStatus() {
    var _this = this
    com.link(app.link.onShopCentent + wx.getStorageSync('store') + '.st', {}, function(res) {
      console.log(res)
      // res.data.data.title = ''
      // res.data.data.address = ''
      _this.setData({
        info: res.data.data
      })
    }, "GET")
  },
  onJumpPage() {
    var _this = this,
      info = _this.data.info,
      i = {}
    if (!info.title) {
      wx.showToast({
        title: '请填写门店名称',
        icon: 'none'
      })
      return false
    }
    if (!info.address) {
      wx.showToast({
        title: '请填写地址',
        icon: 'none'
      })
      return false
    }
    i.address = info.address
    i.title = info.title
    wx.navigateTo({
      url: "/pages/onUploadImage/onUploadImage?info=" + JSON.stringify(i),
    })
  }
})